<?php

/**
* @copyright   (C) 2010 iJoomla, Inc. - All rights reserved.
* @license  GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) 
* @author  iJoomla.com webmaster@ijoomla.com
* @url   http://www.ijoomla.com/licensing/
* the PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript  
* are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 
* More info at http://www.ijoomla.com/licensing/
*/

defined('_JEXEC') or die('Restricted Access');
JHtml::_('behavior.tooltip');

include(JPATH_ROOT.DS."administrator".DS."components".DS."com_surveys".DS."left.php");
jimport('joomla.html.pane');

$document =& JFactory::getDocument();
$document->addStyleSheet("components/com_surveys/css/survey.css");

?>

<script type="text/javascript">
	Joomla.submitbutton = function(pressbutton){		
		var form = document.adminForm;		
		if (pressbutton == 'cancel') {
			submitform(pressbutton);
		}		
		else if(pressbutton == 'save' || pressbutton == 'apply') {			
			i = 0;
			dt = document.getElementsByTagName("dt");
			while(element = dt[i++]){
				if(element.className == "general-panel open"){
					document.adminForm.tab.value = "0";				 
				}
				if(element.className == "css-panel open"){
					document.adminForm.tab.value = "1";				 
				}
				if(element.className == "language-panel open"){
					document.adminForm.tab.value = "2";				 
				}
				if(element.className == "email-panel open"){
					document.adminForm.tab.value = "3";				 
				}
			}
			submitform(pressbutton);
		}
		else{
			submitform( pressbutton );
		}
		
	}
</script>


<form action="index.php" method="post" name="adminForm" id="adminForm">
	
	<?php
		$tab = JRequest::getVar("tab", 0, "post");
		if($tab == 0){
			$tab = JRequest::getVar("tab", 0, "get");
		}
		$tabs =& JPane::getInstance('Tabs', array('startOffset'=>$tab));
		echo $tabs->startPane("Surveys Pane");
		
		echo $tabs->startPanel(JText::_("COM_SURVEYS_GENERAL"), 'general-panel'); 
			require_once(JPATH_SITE.DS."administrator".DS."components".DS."com_surveys".DS."views".DS."config".DS."tmpl".DS."general.php"); 
		echo $tabs->endPanel();
	
		echo $tabs->startPanel(JText::_("COM_SURVEYS_CSS"), 'css-panel'); 
			require_once(JPATH_SITE.DS."administrator".DS."components".DS."com_surveys".DS."views".DS."config".DS."tmpl".DS."css.php"); 
		echo $tabs->endPanel();
		
		echo $tabs->startPanel(JText::_("COM_SURVEYS_LANGUAGE"), 'language-panel'); 
			require_once(JPATH_SITE.DS."administrator".DS."components".DS."com_surveys".DS."views".DS."config".DS."tmpl".DS."language.php"); 
		echo $tabs->endPanel();
		
		echo $tabs->startPanel(JText::_("COM_SURVEYS_EMAIL"), 'email-panel'); 
			require_once(JPATH_SITE.DS."administrator".DS."components".DS."com_surveys".DS."views".DS."config".DS."tmpl".DS."email.php"); 
		echo $tabs->endPanel();
				
		echo $tabs->endPane();
	?>
	
	<input type="hidden" name="option" value="com_surveys" />
	<input type="hidden" name="controller" value="config" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="tab" value="<?php echo JRequest::getVar("tab", "0", "get"); ?>" />
	<?php echo JHtml::_('form.token'); ?>
</form>

</td></tr></table>
<p><center><?php echo JText::_("COM_IJOOMLA_SURVEYS_POWERED_BY") ; ?>&nbsp;<a href='http://www.ijoomla.com' target='_blank'><?php echo JText::_("COM_SURVEYS_SURVEY"); ?></a></center></p>	